const util = require('../../utils/util.js');
import api from '../../utils/request/api'
import { article } from '../../utils/request/apiurl'

Page({
  data: {
    articleList: [],
    counting: false,
    timeCountDownTop: '获取验证码'
  },
  onLoad: function (options) {
    this.getList()
  },
  getList () {
    api.get(article.list).then(res => {
      this.setData({
        articleList: res
      })
    }).catch(err => {
      wx.showToast({
        title: err.message,
        icon: 'none'
      })
    })
  },
  // 发送验证码
  sendPhoneCode () {
    const that = this;
    if (!that.data.counting) {
      wx.showToast({
        title: '验证码已发送',
      })
      
      //开始倒计时60秒
      util.countDown(that, 60);
    }
  }
})